<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="Cache-Control" content="no-siteapp">
<link rel="stylesheet" href="../../../static/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../../../static/css/public.css" media="all" />
<style>
.detailTable_text {
	font-weight: bold;
}
</style>
</head>
<body class="childrenBody">
	<form class="layui-form" lay-filter="formTest" id="form" style="width: 80%;">
		<fieldset class="layui-elem-field layui-field-title site-title">
			<legend>
				<div>薪酬元素</div>
			</legend>
		</fieldset>
		<table class="layui-table mag0">
			<!-- <colgroup>
				<col width="15%">
				<col width="30%">
				<col width="15%">
				<col width="30%">
			</colgroup> -->
			<tbody class="detailTable">
			</tbody>
		</table>
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
			<legend>常规时间线</legend>
		</fieldset>
		<div class="layui-form-item layui-row layui-col-xs12">
			<div class="layui-input-block">
				<button type="button" class="layui-btn layui-btn-sm layui-btn-primary close-btn">取消</button>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="../../../static/js/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="../../../static/layui/layui.js"></script>
	<script type="text/javascript" src="../../../static/custom/js/common.js"></script>
	<script type="text/javascript">
		layui.use([ 'form', 'layer' ], function() {
			var form = layui.form;
			var layer = layui.layer;
			var toUpdateApi = "../../../system/post/toUpdate";
			var id = getUrlParam("id");
			if (id) {
				loadAjax( toUpdateApi + "/" + id, "get", null, function(response) {
					baseCallBack(response, function(response) {
						if (response.data.record.expression) {
							var expressionArray = JSON.parse(response.data.record.expression);
							for (var i = 0; i < expressionArray.length; i++) {
								drawTr(expressionArray[i]);
							}
						}
					});
				});
			}
			function drawTr(expressionObj) {
				var str = '';
				str += '<tr>';
				str += '	<td class="detailTable_text">元素类型</td>';
				str += '	<td><input type="text"  class="layui-input" value="' + (expressionObj['type'] == 1 ? '常量' : expressionObj['type'] == 2 ? '变量' : expressionObj['type'] == 3 ? '系统属性' : '其他') + '"></td>';
				str += '	<td class="detailTable_text">元素名称</td>';
				str += '	<td><input type="text"  class="layui-input" value="'+expressionObj['name']+'"></td>';
				str += '	<td class="detailTable_text">元素key</td>';
				str += '	<td><input type="text"  class="layui-input" value="'+expressionObj['key']+'"></td>';
				str += '	<td class="detailTable_text">元素value</td>';
				str += '	<td><input type="text"  class="layui-input" value="' + toValue(expressionObj['value']) + '"></td>';
				str += '</tr>';
				$(".detailTable").append(str);
			}

			function toValue(str) {
				return str ? str : '';
			}
		})
	</script>
</body>
</html>